

//do "cleandata\figure1b\figure1b_data_do"

use "fig1b_data.dta",clear
 
 

collapse (mean)   gqmental_ratio    gqnonnursing_ratio  enroll_ratio,by(normal year)
sort year normal 


 
tw(connected gqmental year if  normal  == 0 & year >= 1920 & year <= 2000,  msymbol(Dh) mcolor(ebblue) lpattern(soilid) lcolor(ebblue) ) ///
(connected enroll_ratio year if year >=1970 &  normal  == 1,  msymbol(O) mcolor(navy) lpattern(solid) lcolor(navy)) ///
(connected enroll_ratio year if year >=1934 & year <= 1970 &  normal  == 1,  msymbol(O) mcolor(navy) lpattern(dash) lcolor(navy)) ///
(connected enroll_ratio year if year ==1934 &  normal  == 1,  msymbol(O) mcolor(navy) lpattern(solid) lcolor(navy)) ///
(connected enroll_ratio year if year ==1952 &  normal  == 1,  msymbol(O) mcolor(navy) lpattern(solid) lcolor(navy)) ///
(connected gqnonnursing year if  normal  == 0 & year >= 1920 & year <= 1950,  msymbol(Th) mcolor(red) lpattern(solid) lcolor(red) ) ///
(connected gqnonnursing year if  normal  == 0 & year >= 1970 & year <= 2010,  msymbol(Th) mcolor(red) lpattern(solid) lcolor(red) ) ///
(connected gqnonnursing year if  normal  == 1 & year >= 1920 & year <= 1950,  msymbol(Th) mcolor(gs12) lpattern(dash) lcolor(gs12) ) ///
(connected gqnonnursing year if  normal  == 1 & year >= 1970 & year <= 2010,  msymbol(Th) mcolor(gs12) lpattern(dash) lcolor(gs12) ), ///
 xtitle("") ytitle("Institutionalized Pop. or" "Enrollment per County Pop." " " ,size( large ))   legend(order(1 "Mental hospital (Asylum)"  ///
2 "Enrollment in previous""normal schools (Normal)"    6 "All institutions, excluding""Nursing Homes (Asylum)"  8 "All institutions, excluding""Nursing Homes (Normal)")) ///
graphregion(fcolor(white)) xlabel(1920(20)2020)  legend(size(medium)  symys(*0.68) symxs(*0.68))
graph export "figure1b.pdf", as (pdf) replace 
//graph export "figure1b.png", as (png) replace 
 